<template>
	<div>
		<!--表格操作项目-->
		<table class="table" cellspacing="0" cellpadding="0">
			<tbody>
				<tr>
					<th>资源名称</th>
					<th>用户</th>
					<th>支付方式</th>
					<th>实付金额(元)</th>
					<th>订单状态</th>
					<th>购买时间</th>
				</tr>
			</tbody>
			<tbody>
				<tr v-for="(item,index) in allResourcesData" :key="index">
					<td>{{item.ziyuan_title}}</td>
					<td>{{item.nickname}}</td>
					<td>
						<WechatOutlined v-if="item.pay_type=='wxpay' || item.pay_type=='hpjwxpay'" type="wechat" style="color: #66CC00;font-size: 20px;" />
						
						<AlipayCircleOutlined v-else-if="item.pay_type=='alipay'" type="alipay-circle" style="color: #00aaf0;font-size: 20px;" />
						<a-tag v-else-if="item.pay_type=='' || !item.pay_type" color="#87d068">免费</a-tag>
						<span v-else class="d-red">未知</span>
					</td>
					<td>{{item.price}}</td>
					<td>
						<span v-if="item.status==1" style="color: #66CC00;">已支付</span>
						<span v-else-if="item.status==2">已关闭</span>
						<span v-else style="color: #ff6600;">未支付</span>
					</td>
					<td>{{item.create_time}}</td>
				</tr>
			</tbody>
		</table>
		<!-- 分页 -->
		<div class="padding-t-20">
			<a-pagination :pageSize="formCount.pageSize" :current="formCount.page" :total="formCount.count"
				@change="clickPage" :pageSizeOptions="pageSizeOptions" show-size-changer
				@showSizeChange="onShowSizeChange" show-quick-jumper />
		</div>
	</div>
</template>

<script>
	import apiUser from '../../api/resource.js'
	export default {
		data() {
			return {
				// 所有数据
				allResourcesData: [],
				// 分页
				pageSizeOptions: ['20', '50', '100', '150'],
				formCount: {
					count: '',
					page: 1,
					pageSize: 20,
				},
				queryParams: {
					invite_id: '',
					user_name: '',
					phone: '',
					start_time: '',
					end_time: '',
					status: '',
				}
			}
		},
		mounted() {
			this.allResources();
		},
		methods: {
			allResources() {
				apiUser.getOrderList(this.formCount.page, this.formCount.pageSize).then((res) => {
					this.allResourcesData = res.result.data;
					this.formCount.count = res.result.count
				})
			},
			// 分页
			clickPage(e) {
				this.formCount.page = e;
				this.allResources();
			},
			onShowSizeChange(current, pageSize) {
				this.formCount.pageSize = pageSize;
				this.formCount.page = 1;
				this.allResources();
			}
		}
	}
</script>

<style>

</style>
